﻿using System.Net;
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Threading;

namespace orb
{
    public class Program
    {
        static void Ping(string app, string colour)
        {
            using (var client = new WebClient())
            {
                var url = string.Format("http://localhost:4242/{0}/{1}", colour, app);
                client.DownloadString(url);
            }
        }

        public static void Main(string[] args)
        {
            if (args.Length >= 2)
            {
                var app = args[0];
                Ping(app, "yellow");

                // TODO: Run program
                Thread.Sleep(1000);

                Ping(app, "green");
            }
            else
            {
                Console.WriteLine();
                Console.WriteLine("Orb Help");
                Console.WriteLine("========");
                Console.WriteLine();
                Console.WriteLine("\torb <app-name> <command-to-execute>");
                Console.WriteLine();
            }
        }
    }
}
